// 仓库管理——所有接口

import request from '@/utils/request'

// 查询全部仓库
export const getAllWareHouse = (params) => {
  return request({
    url: '/warehouse/list',
    method: 'GET',
    params
  })
}

// 分页查询仓库
export const pageQueryWareHouse = (params) => {
  return request({
    url: '/warehouse/page',
    method: 'GET',
    params
  })
}

// 新增仓库
export const addWareHouse = (data) => {
  return request({
    url: '/warehouse',
    method: 'POST',
    data
  })
}

// 获取下一个编码
export const getNextCode = (name) => {
  return request({
    url: `/codeFactory/next/${name}`,
    method: 'GET'
  })
}

// 查询仓库
export const searchWareHouse = (id) => {
  return request({
    url: `/warehouse/${id}`,
    method: 'GET'
  })
}

// 修改仓库
export const changeWareHouse = (data) => {
  return request({
    url: '/warehouse',
    method: 'PUT',
    data
  })
}

// 删除仓库
export const deleteWareHouse = (id) => {
  return request({
    url: '/warehouse',
    method: 'DELETE',
    params: {
      'ids[]': id
    }
  })
}
